// AUTO GENERATED CODE!
// CODE GENERATOR WILL NOT PRESERVE MANUAL CHANGES TO THIS CODE!
// 

// MIT License (MIT)
// 
// Copyright (c) 2014 K Ercan Turkarslan
// 
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
// 
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
// 
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.
// 


using System;

namespace Mios.Generated.ServiceFiles
{
    // Generated from S_IrDevice1.xml
    
    public class IrDevice1Service : MiosService
    {
        #region Codesets : String;
        private String _mCodesets;
        
        public String Codesets
        {
            get
            {
                return _mCodesets ?? GetCodesets();
            }
        }
        
        // WARNING: Service Description File does not contain any Get Action with a
        // argument related to this State Variable.
        // 
        // This may be due to a typo while defining the Get Action or state variable.
        // This may also be intentional. Code generator assumes this was a mistake and
        // generates this Get Action.
        
        #region Action GetCodesets() : String;
        public String GetCodesets()
        {
            _mCodesets = FromLuupString(Engine.Luup_VariableGet(base.DeviceId, base.ServiceId, "Codesets"));
            
            return _mCodesets;
        }
        #endregion Action GetCodesets
        
        #endregion
        
        #region Codeset : String;
        private String _mCodeset;
        
        public String Codeset
        {
            get
            {
                return _mCodeset ?? GetCodeset();
            }
        }
        
        // WARNING: Service Description File does not contain any Get Action with a
        // argument related to this State Variable.
        // 
        // This may be due to a typo while defining the Get Action or state variable.
        // This may also be intentional. Code generator assumes this was a mistake and
        // generates this Get Action.
        
        #region Action GetCodeset() : String;
        public String GetCodeset()
        {
            _mCodeset = FromLuupString(Engine.Luup_VariableGet(base.DeviceId, base.ServiceId, "Codeset"));
            
            return _mCodeset;
        }
        #endregion Action GetCodeset
        
        #endregion
        
        #region Remote : Int32;
        private Int32? _mRemote;
        
        public Int32 Remote
        {
            get
            {
                return _mRemote ?? GetRemote();
            }
        }
        
        // WARNING: Service Description File does not contain any Get Action with a
        // argument related to this State Variable.
        // 
        // This may be due to a typo while defining the Get Action or state variable.
        // This may also be intentional. Code generator assumes this was a mistake and
        // generates this Get Action.
        
        #region Action GetRemote() : Int32;
        public Int32 GetRemote()
        {
            _mRemote = FromLuupInt32(Engine.Luup_VariableGet(base.DeviceId, base.ServiceId, "Remote"));
            
            return _mRemote.Value;
        }
        #endregion Action GetRemote
        
        #endregion
        
        #region Scene : String;
        private String _mScene;
        
        public String Scene
        {
            get
            {
                return _mScene ?? GetScene();
            }
        }
        
        // WARNING: Service Description File does not contain any Get Action with a
        // argument related to this State Variable.
        // 
        // This may be due to a typo while defining the Get Action or state variable.
        // This may also be intentional. Code generator assumes this was a mistake and
        // generates this Get Action.
        
        #region Action GetScene() : String;
        public String GetScene()
        {
            _mScene = FromLuupString(Engine.Luup_VariableGet(base.DeviceId, base.ServiceId, "Scene"));
            
            return _mScene;
        }
        #endregion Action GetScene
        
        #endregion
        
        
        #region Action SendCode(String codeset, Int32 button, Int32 repeat)
        public void SendCode(String codeset, Int32 button, Int32 repeat)
        {
            if (String.IsNullOrEmpty(codeset))
                throw new ArgumentNullException("codeset");
            
            Engine.Luup_CallAction(base.DeviceId, base.ServiceId, "SendCode"
                , String.Format("Codeset={0}", ToLuup(codeset))
                , String.Format("Button={0}", ToLuup(button))
                , String.Format("Repeat={0}", ToLuup(repeat))
                ); // Engine.Luup_CallAction
        }
        #endregion Action SendCode
        
        
        #region Method SetVariable(String name, String value) : Boolean;
        internal override Boolean SetVariable(String name, String value)
        {
            switch(name)
            {
                case "Codeset":
                    _mCodeset = FromLuupString(value); return true;
                case "Codesets":
                    _mCodesets = FromLuupString(value); return true;
                case "Remote":
                    _mRemote = FromLuupInt32(value); return true;
                case "Scene":
                    _mScene = FromLuupString(value); return true;
                default:
                    return false;
            }
        }
        #endregion Method SetVariable
        
        public IrDevice1Service(MiosEngine engine, UInt32 deviceId, String serviceId)
            : base(engine, deviceId, serviceId)
        {
            
        } //End Constructor
    } //End of class
} //End of Namespace

